// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package com.sec.android.app.calculator;

import android.content.Context;
import java.io.*;

// Referenced classes of package com.sec.android.app.calculator:
//            History

class Persist
{

    Persist(Context context)
    {
        history = new History();
        mContext = context;
        load();
    }

    private void load()
    {
        BufferedInputStream bufferedinputstream;
        DataInputStream datainputstream;
        bufferedinputstream = null;
        datainputstream = null;
        BufferedInputStream bufferedinputstream1 = new BufferedInputStream(mContext.openFileInput("calculator.data"), 8192);
        DataInputStream datainputstream1 = new DataInputStream(bufferedinputstream1);
        int i;
        i = datainputstream1.readInt();
        if(i > 1)
            throw new IOException((new StringBuilder()).append("data version ").append(i).append("; expected ").append(1).toString());
          goto _L1
        FileNotFoundException filenotfoundexception;
        filenotfoundexception;
        FileNotFoundException filenotfoundexception1;
        filenotfoundexception1 = filenotfoundexception;
        datainputstream = datainputstream1;
        bufferedinputstream = bufferedinputstream1;
_L7:
        filenotfoundexception1.printStackTrace();
        IOException ioexception8;
        IOException ioexception9;
        if(datainputstream != null)
            try
            {
                datainputstream.close();
            }
            catch(IOException ioexception7)
            {
                ioexception7.printStackTrace();
            }
        if(bufferedinputstream == null)
            break MISSING_BLOCK_LABEL_116;
        bufferedinputstream.close();
_L2:
        return;
_L1:
        history = new History(i, datainputstream1);
        if(datainputstream1 != null)
            try
            {
                datainputstream1.close();
            }
            // Misplaced declaration of an exception variable
            catch(IOException ioexception9)
            {
                ioexception9.printStackTrace();
            }
        if(bufferedinputstream1 != null)
            try
            {
                bufferedinputstream1.close();
            }
            // Misplaced declaration of an exception variable
            catch(IOException ioexception8)
            {
                ioexception8.printStackTrace();
            }
          goto _L2
        IOException ioexception6;
        ioexception6;
        ioexception6.printStackTrace();
          goto _L2
        IOException ioexception11;
        ioexception11;
        IOException ioexception1 = ioexception11;
_L5:
        ioexception1.printStackTrace();
        if(datainputstream != null)
            try
            {
                datainputstream.close();
            }
            catch(IOException ioexception5)
            {
                ioexception5.printStackTrace();
            }
        if(bufferedinputstream != null)
            try
            {
                bufferedinputstream.close();
            }
            catch(IOException ioexception4)
            {
                ioexception4.printStackTrace();
            }
          goto _L2
        Exception exception;
        exception;
_L4:
        if(datainputstream != null)
            try
            {
                datainputstream.close();
            }
            catch(IOException ioexception3)
            {
                ioexception3.printStackTrace();
            }
        if(bufferedinputstream != null)
            try
            {
                bufferedinputstream.close();
            }
            catch(IOException ioexception2)
            {
                ioexception2.printStackTrace();
            }
        throw exception;
        exception;
        bufferedinputstream = bufferedinputstream1;
        continue; /* Loop/switch isn't completed */
        exception;
        datainputstream = datainputstream1;
        bufferedinputstream = bufferedinputstream1;
        if(true) goto _L4; else goto _L3
_L3:
        IOException ioexception10;
        ioexception10;
        ioexception1 = ioexception10;
        bufferedinputstream = bufferedinputstream1;
          goto _L5
        IOException ioexception;
        ioexception;
        ioexception1 = ioexception;
        datainputstream = datainputstream1;
        bufferedinputstream = bufferedinputstream1;
          goto _L5
        FileNotFoundException filenotfoundexception3;
        filenotfoundexception3;
        filenotfoundexception1 = filenotfoundexception3;
        continue; /* Loop/switch isn't completed */
        FileNotFoundException filenotfoundexception2;
        filenotfoundexception2;
        filenotfoundexception1 = filenotfoundexception2;
        bufferedinputstream = bufferedinputstream1;
        if(true) goto _L7; else goto _L6
_L6:
    }

    void save()
    {
        BufferedOutputStream bufferedoutputstream;
        DataOutputStream dataoutputstream;
        bufferedoutputstream = null;
        dataoutputstream = null;
        BufferedOutputStream bufferedoutputstream1 = new BufferedOutputStream(mContext.openFileOutput("calculator.data", 0), 8192);
        DataOutputStream dataoutputstream1 = new DataOutputStream(bufferedoutputstream1);
        dataoutputstream1.writeInt(1);
        history.write(dataoutputstream1);
        if(dataoutputstream1 == null)
            break MISSING_BLOCK_LABEL_68;
        dataoutputstream1.close();
        if(bufferedoutputstream1 != null)
            try
            {
                bufferedoutputstream1.close();
            }
            catch(IOException ioexception16)
            {
                ioexception16.printStackTrace();
            }
_L1:
        if(bufferedoutputstream1 == null)
            break MISSING_BLOCK_LABEL_76;
        bufferedoutputstream1.close();
_L2:
        return;
        IOException ioexception14;
        ioexception14;
        ioexception14.printStackTrace();
        if(bufferedoutputstream1 != null)
            try
            {
                bufferedoutputstream1.close();
            }
            catch(IOException ioexception15)
            {
                ioexception15.printStackTrace();
            }
          goto _L1
        Exception exception3;
        exception3;
        if(bufferedoutputstream1 != null)
            try
            {
                bufferedoutputstream1.close();
            }
            catch(IOException ioexception13)
            {
                ioexception13.printStackTrace();
            }
        throw exception3;
        IOException ioexception12;
        ioexception12;
        ioexception12.printStackTrace();
          goto _L2
        IOException ioexception18;
        ioexception18;
        IOException ioexception1 = ioexception18;
_L7:
        ioexception1.printStackTrace();
        if(dataoutputstream == null)
            break MISSING_BLOCK_LABEL_175;
        dataoutputstream.close();
        if(bufferedoutputstream != null)
            try
            {
                bufferedoutputstream.close();
            }
            catch(IOException ioexception11)
            {
                ioexception11.printStackTrace();
            }
_L3:
        if(bufferedoutputstream != null)
            try
            {
                bufferedoutputstream.close();
            }
            catch(IOException ioexception7)
            {
                ioexception7.printStackTrace();
            }
          goto _L2
        IOException ioexception9;
        ioexception9;
        ioexception9.printStackTrace();
        if(bufferedoutputstream != null)
            try
            {
                bufferedoutputstream.close();
            }
            catch(IOException ioexception10)
            {
                ioexception10.printStackTrace();
            }
          goto _L3
        Exception exception2;
        exception2;
        if(bufferedoutputstream != null)
            try
            {
                bufferedoutputstream.close();
            }
            catch(IOException ioexception8)
            {
                ioexception8.printStackTrace();
            }
        throw exception2;
        Exception exception;
        exception;
_L6:
        if(dataoutputstream == null)
            break MISSING_BLOCK_LABEL_275;
        dataoutputstream.close();
        if(bufferedoutputstream != null)
            try
            {
                bufferedoutputstream.close();
            }
            catch(IOException ioexception6)
            {
                ioexception6.printStackTrace();
            }
_L4:
        Exception exception1;
        IOException ioexception3;
        IOException ioexception4;
        IOException ioexception5;
        if(bufferedoutputstream != null)
            try
            {
                bufferedoutputstream.close();
            }
            catch(IOException ioexception2)
            {
                ioexception2.printStackTrace();
            }
        throw exception;
        ioexception4;
        ioexception4.printStackTrace();
        if(bufferedoutputstream != null)
            try
            {
                bufferedoutputstream.close();
            }
            // Misplaced declaration of an exception variable
            catch(IOException ioexception5)
            {
                ioexception5.printStackTrace();
            }
          goto _L4
        exception1;
        if(bufferedoutputstream != null)
            try
            {
                bufferedoutputstream.close();
            }
            // Misplaced declaration of an exception variable
            catch(IOException ioexception3)
            {
                ioexception3.printStackTrace();
            }
        throw exception1;
        exception;
        bufferedoutputstream = bufferedoutputstream1;
        continue; /* Loop/switch isn't completed */
        exception;
        dataoutputstream = dataoutputstream1;
        bufferedoutputstream = bufferedoutputstream1;
        if(true) goto _L6; else goto _L5
_L5:
        IOException ioexception17;
        ioexception17;
        ioexception1 = ioexception17;
        bufferedoutputstream = bufferedoutputstream1;
          goto _L7
        IOException ioexception;
        ioexception;
        ioexception1 = ioexception;
        dataoutputstream = dataoutputstream1;
        bufferedoutputstream = bufferedoutputstream1;
          goto _L7
    }

    History history;
    private Context mContext;
}
